package com.lonty.intelligence.controller;

import com.lonty.intelligence.api.Result;
import com.lonty.intelligence.api.ResultCode;
import com.lonty.intelligence.service.StreetKnowsService;
import com.lonty.intelligence.vo.StreetKnowsVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;

/**
 * @Author 陈璇
 * @Date 2020/6/28 10:56
 * @Version 1.0
 */
@RestController
@RequestMapping("app/streetKnows")
@Validated
@Api(tags = "街道知道接口", produces = "application/json")
public class StreetKnowsController {

    @Resource
    private StreetKnowsService streetKnowsService;

    @ApiOperation(value = "保存街道知道", httpMethod = "POST")
    @PostMapping("saveStreetKnows")
    public Result saveStreetKnows(@ModelAttribute StreetKnowsVo streetKnowsVo){
        if(streetKnowsService.saveStreetKnows(streetKnowsVo)){
            return Result.builder().build();
        }
        return Result.builder(ResultCode.OPERATION_ERROR).build();
    }

    @ApiOperation(value = "获取街道知道列表", httpMethod = "GET")
    @GetMapping("getStreetKnowsList")
    public Result getStreetKnowsList(){
        return Result.builder()
                .data(streetKnowsService.getStreetKnowsList())
                .build();
    }

}
